Attribute VB_Name = "DataProvider"
Option Explicit

'---------------------------------------------------------------------------------------
' Procedure : OpenConnection
' Date      : 27/10/2011
' Purpose   : Mo ket noi den file du lieu
'---------------------------------------------------------------------------------------
Public Sub OpenConnection()
   On Error GoTo OpenConnection_Error
    
    Set g_ObjADOConn = Nothing
    Set g_ObjADOConn = New ADODB.Connection
    g_ObjADOConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;data source=" & App.Path & "/QuanLyDiem.mdb;Persist Security Info=False"
    g_ObjADOConn.Open

   On Error GoTo 0
   Exit Sub
OpenConnection_Error:
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure OpenConnection of Module DataProvider"
End Sub

'---------------------------------------------------------------------------------------
' Procedure : CloseConnection
' Date      : 27/10/2011
' Purpose   : Don ket noi sau khi su dung xong (sau khi thuc hien thao tac them xoa sua)
'---------------------------------------------------------------------------------------
Public Sub CloseConnection()
   On Error GoTo CloseConnection_Error

    g_ObjADOConn.Close
    Set g_ObjADOConn = Nothing

   On Error GoTo 0
   Exit Sub
CloseConnection_Error:
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure CloseConnection of Module DataProvider"
End Sub

